package cn.com.joycode.nimble.examples.application;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class RunnerExample implements ApplicationRunner {

    @Autowired
    private SpringContextUtil springContextUtil;

    @Autowired
    private ApplicationContext applicationContext;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        ApplicationContext context = applicationContext;
        log.info("================ {}:{}", context.getClass().getName(), context);
        log.info("================ {}", SpringContextUtil.getActiveProfile());
    }
}
